<template>
    <div id="home">
        <el-container>
            <el-header>
                <el-row>
                    <el-col :span="4">
                        <h1>吃了吗后台管理系统</h1>
                    </el-col>
                    <el-col :span="3" style="float: right">
                        <el-dropdown @command="handleCommand">
                            <span class="el-dropdown-link" style="z-index:200;color:white;">
                                个人中心<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item>简介</el-dropdown-item>
                                <el-dropdown-item command="quit">退出登录</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </el-col>
                </el-row>
            </el-header>
            <el-container>
                <el-aside width="260px">
                    <el-row>
                        <el-col :span="24">
                            <el-menu
                            default-active="2"
                            class="el-menu-vertical-demo"
                            @open="handleOpen"
                            @close="handleClose"
                            background-color="white"
                            text-color="black"
                            router
                            active-text-color="#31c27c">
                                <el-submenu index="1">
                                    <template slot="title">
                                        <i class="el-icon-location"></i>
                                        <span>前端会员功能管理</span>
                                    </template>
                                    <el-menu-item-group>
                                        <el-menu-item index="memberRecord">用户购买会员记录</el-menu-item>
                                        <el-menu-item index="memberType">会员类型管理</el-menu-item>
                                        <el-menu-item index="memberPrice">会员价格管理</el-menu-item>
                                    </el-menu-item-group>
                                </el-submenu>
                            </el-menu>
                        </el-col>
                    </el-row>
                </el-aside>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
export default {
    data(){
        return{

        }
    },
    methods:{
         //个人下拉框方法
        handleCommand(command) {
            if(command === 'quit') {
                this.message('退出成功', 'success')
                window.sessionStorage.removeItem('token')
                window.sessionStorage.removeItem('loginName')
                window.sessionStorage.removeItem('id')
                this.$router.push({name: 'login'})
            }
        },
        handleOpen(key, keyPath) {
        },
        handleClose(key, keyPath) {
        }
    },
    mounted(){
        window.sessionStorage.setItem('token', 'asdqwe')
    }
}
</script>

<style>
.el-menu-item{
    color:white;
}
#home , .el-container{
    height:100%;
    overflow:hidden;
}
.el-header, .el-footer {
    background-color: #31c27c;
    color: rgb(255, 255, 255);
    line-height: 60px;
}
.el-aside {
    background-color: #31c27c;
    color: rgb(255, 255, 255);
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
}

body > .el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
}
</style>